//
//  HLJSWebViewController.h
//  JS2WebView
//
//  Created by hongliang on 16/3/7.
//  Copyright (c) 2016年 hongliang. All rights reserved.
//

#import "HLBaseWebViewController.h"
#import <JavaScriptCore/JavaScriptCore.h>

typedef id (^JCCallbackBlock)();

@interface HLJSWebViewController : HLBaseWebViewController
@property(nonatomic, strong, readonly)JSContext* jsContext;

/**
 *  native method invoke JS function
 *
 *  @param name   js function name
 *  @param arg1   js funciton arguments
 *
 *  @return 
 */
- (JSValue*)jsMethod:(NSString*)name arguments:(NSString*)arg1,...;

/**
 *  register native method for JS function to invoke it
 *
 *  @param name     native method name
 *  @param callback native method callback block
 */
- (void)registerOCMethod:(NSString*)name block:(JCCallbackBlock)callback;

/**
 *  register native objc
 *
 *  @param name     native objc name
 *  @param callback native objc
 */
- (void)registerOCModel:(NSString*)name objc:(id)objc;
@end
